﻿using System.Collections.Generic;
using System.ComponentModel;
using System.Web.Mvc;
using MNH.WebApps.Common.Data;

namespace MNH.WebApps.Common.Mvc
{
    /// <summary>
    /// Base mketab model
    /// </summary>
    public partial class BaseModel
    {
        public BaseModel()
        {
            this.CustomProperties = new Dictionary<string, object>();
        }
        public virtual void BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext)
        {
        }

        /// <summary>
        /// Use this property to store any custom value for your models. 
        /// </summary>
        public Dictionary<string, object> CustomProperties { get; set; }
    }

    /// <summary>
    /// Base mketab entity model
    /// </summary>
    public partial class BaseEntityModel : BaseModel
    {
        public virtual int Id { get; set; }
        [DisplayName("ردیف")]
        public virtual int RowNumber { get; set; }

        public bool Result { get; set; }
        public bool CanEdit { get; set; }
        public bool CanDelete { get; set; }
    }

    public class PaginationEntityModel : BaseModel
    {
        public PaginationEntityModel()
        {
            PageSize = 100;
        }

        [DisplayName("شماره صفحه")]
        public virtual int PageIndex { get; set; }

        [DisplayName("تعداد رکورد")]
        public virtual int PageSize { get; set; }

        public int TotalCount { get; set; }

        public List<SelectListItem> PageIndexes { get; set; }

        public List<SelectListItem> PageSizes
        {
            get
            {
                return new List<SelectListItem> 
                {
                    new SelectListItem {Value = "50", Text = "50" },
                    new SelectListItem {Value = "100", Text = "100", Selected = true},
                    new SelectListItem {Value = "200", Text = "200"},
                    new SelectListItem {Value = "500", Text = "500"},
                    new SelectListItem {Value = "1000", Text = "1000"}
                };
            }
        }
    }
}
